#include "xlcomm/net/poller/poller.h"

#include "xlcomm/base/logger.h"

namespace xlcomm {
namespace net {

Poller::Poller(EventLoop* loop) : loop_(loop) {
  XLCOMM_ASSERT(loop_ != nullptr);
}

Poller::~Poller() {}

bool Poller::HasChannel(Channel* channel) const {
  XLCOMM_ASSERT(loop_->IsInLoopThread());
  auto iter = fd_channel_map_.find(channel->fd());
  if (iter == fd_channel_map_.end()) return false;
  return iter->second == channel;
}

}  // namespace net
}  // namespace xlcomm